package main

import (
	"bilichatroom/model"
	"bilichatroom/pkg/DB"
	"bilichatroom/service"
	"fmt"
	"golang.org/x/net/websocket"
	"net/http"
	"os"
)

func main() {
	//初始化数据库连接
	DB.Init()
	//初始化数据库表
	model.Init()
	//开放接口
	socketService := service.BiliSocketService{}
	http.Handle("/connect", websocket.Handler(socketService.Connect))

	fmt.Println("server 启动")
	if err := http.ListenAndServe(":9999", nil); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}
